def cache_deco(func):
    cache = {}

    def wrapper(n):
        if n in cache:
            return cache[n]
        result = func(n)
        cache[n] = result
        return result
    return wrapper


@cache_deco
def fibo(n):
    print("called")
    if n < 2:
        return n
    return fibo(n - 1) + fibo(n - 2)


if __name__ == "__main__":
    print(fibo(10))
    print('before cache')
    print(fibo(10))
